Skip to main content

Posts

Showing posts with the label How To

Syntax Highlighter - Beautify source code in Blogger

For my tastes, the source code ought to be colorful.  As the site is about development, I frequently had to enter the source code, however Syntax Highlighter consistently let me down. Although Wordpress provides a ton of plug-in possibilities, since this is Google Blogger, you'll have to build it yourself. The Syntax Highlighter feature in Google Blogger also offers a variety of choices. The ensuing standards were set up in order to choose one of them. 99% of geeks' tastes can be characterized by this criterion. So, What kind of SyntaxHighlighters could we use? The most used Syntax Highlighter is by Alex Gorbatchev. It is old and powerful functions, but... Crucially, I was dissatisfied with having to load a separate Javascript file called a brush for each required language. So I put this aside for now. 1. SHJS was also excluded because separate .js files had to be loaded for each language. 2. H ighlight.js supports a wide variety of languages and configuration file formats, a...

Client and Server Using OpenSSL Library In C Programmaing

In this example code, we will create a secure connection between client and server using the TLS1.2 protocol. In this communication, the client sends an XML request to the server which contains the username and password. Then, the server will verifies the XML request, if it is valid then it sends a proper XML response to the client either give a message of Invalid Request. How to install OpenSSL Lib: sudo apt-get install libssl–dev Generate your own certificate : openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem Example Client code for TLS1.2 communication #include <stdio.h> #include <errno.h> #include <unistd.h> #include <malloc.h> #include <string.h> #include <sys/socket.h> #include <resolv.h> #include <netdb.h> #include <openssl/ssl.h> #include <openssl/err.h> #define FAIL -1 #include <stdio.h> #include <errno.h> #include <unistd.h> #include <malloc.h...

Ubuntu/Linux: How to use the JsonCpp Lib in C++

JsonCpp is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs. Step 1: Install using apt-get You can easily install JsonCpp library on Ubuntu or another flavor of Debian Linux simply by running the following command: sudo apt-get install libjsoncpp-dev It will install the compatible JsonCpp library on your system. Step 2: Example program and compiler flag To compile a C++ program that uses JsonCpp library use the compiler flag: -ljsoncpp Create a Json file called profile.json with the following content: { "firstname":"Amritpal", "lastname": "Singh", "ss": 12345678910 } Within the same directory create a userdata.cpp file with the following source code: #include <iostream> #include <fstream> #include <jsoncpp/json/json.h> using namespace std; int main() { ifstream ifs("profile.json"); Json::Reader read...